package cn.com.vastbase.hibernate.sample;

import cn.com.vastbase.hibernate.sample.springmvc.business.dao.IPersonDAO;
import cn.com.vastbase.hibernate.sample.springmvc.business.entity.Person;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class SpringHibernate5Main {

    public static void main(String[] args) {

        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");

        IPersonDAO personDAO = context.getBean(IPersonDAO.class);
        Person person = new Person();
        person.setName("Pankaj");
        person.setCountry("India");
        personDAO.save(person);
        System.out.println("Person::" + person);
        List<Person> list = personDAO.list();
        for (Person p : list) {
            System.out.println("Person List::" + p);
        }

        context.close();

    }
}
